# -*- coding:UTF-8 -*-
"""
@Project : SeleniumAutoTest
@File    : example.py
@IDE     : PyCharm
@Author  : WorldWind(1772830365@qq.com)
@Address : China - HeiLongjiang - Herbin
@Date    : 2025/7/31 下午3:28
"""
from selenium import webdriver
from time import sleep
from selenium.webdriver.chrome.service import Service

from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
service = Service('D:\chromedriver-win64\chromedriver.exe') # 配置chromedriver.exe速度更快,否则可能会等很久才能自动打开浏览器
dr = webdriver.Chrome(service=service)
dr.get("https://mail.163.com/")

dr.maximize_window()
iframe=dr.find_element(By.TAG_NAME,'iframe')
dr.switch_to.frame(iframe)     # 切换到内部的html网页

dr.find_element(By.CSS_SELECTOR,'[placeholder="邮箱账号或手机号码"]').send_keys('zhangsan')
sleep(5)
#dr.switch_to.parent_frame()   # 切换到上一级的html网页
dr.switch_to.default_content() # 切换到最外层的html网页
dr.find_element(By.LINK_TEXT,'企业邮箱').click()

sleep(10)
dr.quit()